﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using Sauces.Bussinees.Entities.Almacen;
using Sauces.Bussinees.Entities.Ventas;
using Sauces.Bussinees.Entities.Caja;
using Sauces.Bussinees.Entities.Compras;
using Sauces.Repository.Mapping;


namespace Sauces.Repository
{
    public class SaucesContext:DbContext
    {
        public SaucesContext()
        {
            Database.SetInitializer<SaucesContext>(new DropCreateDatabaseIfModelChanges<SaucesContext>());
            this.Configuration.ProxyCreationEnabled = false;
        }
        public DbSet<Producto> Producto { set; get; }
        public DbSet<Categoria> Categoria { set; get; }
        public DbSet<NotaPedido> NotaPedido { set; get; }
        public DbSet<DetalleNotaPedido> DetalleNotaPedido { set; get; }
        public DbSet<Cliente> Cliente { set; get; }
        public DbSet<Boleta> Boleta { set; get; }
        public DbSet<DetalleBoleta> DetalleBoleta { set; get; }
        public DbSet<Factura> Factura { set; get; }
        public DbSet<DetalleFactura> DetalleFactura { set; get; }
        public DbSet<PedidoProveedor> PedidoProveedor { set; get; }
        public DbSet<DetallePedidoProveedor> DetallePedidoProveedor { set; get; }
        public DbSet<Proveedor> Proveedor { set; get; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new CategoriaMap());
            modelBuilder.Configurations.Add(new ProductoMap());
            modelBuilder.Configurations.Add(new BoletaMap());
            modelBuilder.Configurations.Add(new FacturaMap());
            modelBuilder.Configurations.Add(new ClienteMap());
            modelBuilder.Configurations.Add(new PedidoProveedorMap());            
            modelBuilder.Configurations.Add(new DetalleBoletaMap());
            modelBuilder.Configurations.Add(new ProveedorMap());
            modelBuilder.Configurations.Add(new DetalleFacturaMap());
            modelBuilder.Configurations.Add(new NotaPedidoMap());
            modelBuilder.Configurations.Add(new DetalleNotaPedidoMap());
            modelBuilder.Configurations.Add(new DetallePedidoProveedorMap());
        }
    
    }
}
